﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace Vacation.Models
{
    public class Course
    {
        //{0} 必须至少包含 {2} 个字符错误消息格式里，0为字段名，1为第一个参数，2为第二个参数
        //StringLength中第一个参数为最大字符长度
        [Key]
        [Display(Name = "课号")]
        [Required]
        [RegularExpression(@"^[0-9]{3,3}[A-Z]{1,1}[0-9]{2,2}[A-Z]{1,1}$",ErrorMessage ="课号格式不正确。示例：085A01A")]
        public string CourseNo { get; set; }

        [Display(Name = "课名")]
        [StringLength(50, ErrorMessage = "{0} 不能超过 {1} 个字符。")]
        public string Name { get; set; }

        [Display(Name = "课程类型")]
        public string Type { get; set; }

        [Display(Name = "开设学院")]
        public string School { get; set; }

        [Display(Name = "操作员")]
        public string Teacher { get; set; }

        [Display(Name = "更新时间")]
        [DataType(DataType.Date)]
        public DateTime Date  { get; set; }

    }
    public class ScoreModel
    {
        [Key]
        [Display(Name = "课号")]
        public string CourseNo { get; set; }
        
        [Display(Name = "课名")]
        public string Name { get; set; }

        [Display(Name = "课程类型")]
        public string Type { get; set; }

        [Display(Name = "学院")]
        public string School { get; set; }

        [Display(Name = "总分")]
        public int Total { get; set; }

        [Display(Name = "默认值")]
        public int Normal { get; set; }

        [Display(Name = "不填分值")]
        public bool NoScore { get; set; }

        [Display(Name = "教师学院")]
        public string TeacherSchool { get; set; }

        public IList<StudentScore> studentScore { get; set; }

    }
    public class StudentsModel
    {
        public int total { get; set; }
        public int pagesize { get; set; }
        public IList<StudentScore> studentscore { get; set; }
    }
    public class StudentScore
    {
        public string StudentNo { get; set; }

        public string Name { get; set; }

        public string Class { get; set; }

        public decimal Score { get; set; }

        public string Teacher { get; set; }

        public string Date { get; set; }
    }
}